<?php
include_once '../includes/common.php';
include_once SYSTEM_ROOT . 'txprotect.php';
if ($_GET['act'] == 'getBackground') {
    require SYSTEM_ROOT . 'lib/Template.php';
    $template = new Template();
    header("Cache-Control: public, max-age=86400");
    header("Expires: " . date(DATE_RFC822, strtotime("1 days")));
    header('content-type: image/jpeg');
    exit(header('location:' . $template->getBackground()));
}
$appid = "1000";
$approw = $DB->getRow("select * from pre_apps where appid='$appid' limit 1");
$appkey = $approw['appkey'];
if (!empty($_GET['code']) && !empty($_GET['type'])) {
    if ($_GET['state'] != $_SESSION['Oauth_state']) {
        sysmsg('<h2>The state does not match. You may be a victim of CSRF.</h2><br><a href="./">尝试重新登录</a>');
    }
    header('Location:./#' . $_SESSION['href'] . '/code=' . $_GET['code'] . '/type=' . $_GET['type']);
    exit();
}
if ($conf['cdn_public'] == 1) {
    $cdnpublic = '//cdn.staticfile.org/';
} elseif ($conf['cdn_public'] == 2) {
    $cdnpublic = '//cdn.bootcss.com/';
} elseif ($conf['cdn_public'] == 3) {
    $cdnpublic = '//cdnjs.cloudflare.com/ajax/libs/';
} else {
    $cdnpublic = '//lib.baomitu.com/';
}
if (!empty($conf['cdn_private'])) {
    $cdnprivate = '//' . $conf['cdn_private'] . '/';
} else {
    $cdnprivate = null;
}
?>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>
  <?echo $conf['web_name']; ?> - 用户中心</title>
  <link rel="icon" type="image/ico" href="../assets/img/htfavicon.ico">
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="<?php echo $cdnpublic ?>layui/2.6.5/css/layui.css" media="all">
</head>

<body>
  <div id="LAY_app"></div>
  <script src="<?php echo $cdnpublic ?>layui/2.6.5/layui.min.js"></script>
  <script src="<?php echo $cdnpublic ?>clipboard.js/2.0.8/clipboard.min.js"></script>
  <script>
    layui.config({
      base: '<?php echo empty($cdnprivate) ? '../' : $cdnprivate ?>layui/' //指定 layuiAdmin 项目路径，本地开发用 src，线上用 dist
        ,
      version: '<?echo VERSION ?>'
    }).extend({ //设定模块别名
      index: 'lib/user/index'
    }).use('index', function () {
      var setter = layui.setter;
      layui.data(setter.tableName, {
        key: 'author',
        value: '<?echo kfqq($conf['web_kfqq']) ?>'
      });
      layui.data(setter.tableName, {
        key: 'sitetime',
        value: '<?echo $conf['web_sitetime']; ?>'
      });
      layui.data(setter.tableName, {
        key: 'web_name',
        value: '<?echo $conf['web_name']; ?>'
      });
    });
  </script>
</body>

</html>
